#pragma once

#include "type.h"

#include "Movable.h"

namespace RenderSystem
{
	class RenderQueue;
	class SceneNode;
	class Renderer;
	class Camera;
	class ResManager;
	class ResourceCreateContext;

	class Instance;
	class MeshInstance;

	class SceneManager
	{
	public:

		typedef std::vector< ResManager* >		ResManagers;
		typedef ResManagers::iterator			ResManagersIterator;
		typedef ResManagers::const_iterator		ResManagersConstIterator;

		SceneManager( void );
		virtual ~SceneManager( void );

		virtual void RenderScene( void );

		SceneNode* GetRootNode( void );

		MeshInstance* CreateMeshInstance( const String& rMeshId ); 

		void RegisterResManager( ResManager* pResMgr );
		void UnregisterResManager( ResManager* pResMgr );
		void UnregisterAllResManager( void );

	protected:

		Instance* _CreateInstance( const String& strMovableType, const String& strResId );

		virtual void _UpdateSceneGraph( void );

		virtual void _FindVisibleObjects( void );

		virtual SceneNode* _CreateSceneNodeImpl(void);

	protected:

		String			m_strId;

		RenderQueue*	m_pRenderQueue;

		Renderer*		m_pDestRenderSystem;
		Camera*			m_pCurCameras;
		SceneNode*		m_pSceneRoot;

		ResManagers		m_conResManagers;
	};
}